import 'package:OASys/components/TabBarWidget.dart';
import 'package:OASys/views/report/myReport.dart';
import 'package:flutter/material.dart';

class ReportPage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MyReportPage();
  }
}

class MyReportPage extends StatefulWidget {
  @override
  _MyReportPageState createState() => _MyReportPageState();
}

class _MyReportPageState extends State<MyReportPage> {
  @override
  Widget build(BuildContext context) {
    List<Widget> tabs = [
      _renderTab(Text("我的汇报(发送)")),
      _renderTab(Text("我的汇报(接收)")),
    ];
    //一个控件，可以监听返回键
    return TabBarWidget(
      title: Text("通知公告管理"),
      type: TabBarWidget.TOP_TAB,
      tabItems: tabs,
      tabViews: [MyReport(0), MyReport(1)],
      backgroundColor: Theme.of(context).primaryColor,
      indicatorColor: Theme.of(context).indicatorColor,
    );
  }

  _renderTab(text) {
    //返回一个标签
    return new Tab(
        child: new Container(
      //设置paddingTop为6
      padding: new EdgeInsets.only(top: 6),
      //一个列控件
      child: new Column(
        //竖直方向居中
        mainAxisAlignment: MainAxisAlignment.center,
        //水平方向居中
        crossAxisAlignment: CrossAxisAlignment.center,
        children: <Widget>[text],
      ),
    ));
  }
}
